package com.hxj.admin.szjy.web;

import com.hxj.admin.szjy.pojo.command.ProjectSaveToNextCommand;
import com.hxj.admin.szjy.pojo.command.StartNewProjectCommand;
import com.hxj.admin.szjy.pojo.po.Usermanager;
import com.hxj.admin.szjy.pojo.query.ProjectQuery;
import com.hxj.admin.szjy.pojo.query.UserQuery;
import com.hxj.admin.szjy.service.ProjectService;
import com.hxj.admin.szjy.service.UsermanagerService;
import com.hxj.common.core.pojo.bo.RestResult;
import com.hxj.flowable.domain.dto.FlowTaskDto;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.Optional;

/**
 * @Author hxj
 * @Date 2024/10/26 15:36
 * @Description
 */
@RestController
@RequiredArgsConstructor
@RequestMapping("/usermanager")
public class UserController {

    private final UsermanagerService userService;

    @ResponseBody
    @GetMapping("/list")
    public RestResult list(UserQuery userQuery) {
        return RestResult.fail(20000, "请求成功", userService.getAdminUserByDistNo(userQuery));
    }

    @ResponseBody
    @GetMapping("/get")
    public RestResult get(Integer id) {
        return RestResult.fail(20000, "请求成功", userService.getById(id));
    }

    @ResponseBody
    @GetMapping("/save")
    public RestResult save(Usermanager usermanager) {
        userService.saveUser(usermanager);
        return RestResult.fail(20000, "请求成功", null);
    }

}
